package com.twu.biblioteca.movie;


import com.twu.biblioteca.IOStream.Message;

import java.util.Vector;

public class Movies {
    private Vector<Movie> movies;

    public Movies() {
        movies = new Vector<Movie>();
    }

    public Vector<Movie> getMovies() {
        return movies;
    }

    public void addMovie(Movie movie) {
        movies.addElement(movie);
    }

    public Message viewAllMoviesMessage() {
        StringBuffer moviesString = new StringBuffer();
        moviesString.append("Movie   Year   Director   Rating\n");
        for (int i = 0; i < movies.size(); i++) {
            moviesString.append(movies.elementAt(i).toString());
        }
        return new Message(moviesString.toString());
    }
}
